import { createRouter, createWebHistory } from "vue-router";
import type { RouteRecordRaw } from "vue-router";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    redirect: "/index",
  },
  {
    path: "/index",
    name: "index",
    component: () => import("@/pages/IndexPage.vue"),
    meta: {
      keepAlive: true, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/pages/LoginPage.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/main/:condition?",
    name: "main",
    component: () => import("@/pages/MainHolder.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/resurrection",
    name: "resurrection",
    component: () => import("@/pages/ResurrectionHolder.vue"),
    meta: {
      keepAlive: true, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/pic/:id",
    name: "pic",
    component: () => import("@/pages/SingleBigImage.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/main2",
    name: "main2",
    component: () => import("@/pages/PaginationHolder.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/upload",
    name: "upload",
    component: () => import("@/pages/UploadPics.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/ext",
    name: "ext",
    component: () => import("@/pages/FileExt.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/water",
    name: "water",
    component: () => import("@/pages/WaterFall.vue"),
    meta: {
      keepAlive: true, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/abracadabra",
    name: "abracadabra",
    component: () => import("@/pages/AbracadabraPage.vue"),
    meta: {
      keepAlive: true, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/search",
    name: "search",
    component: () => import("@/pages/SearchTags.vue"),
    meta: {
      keepAlive: true, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/:w+",
    name: "404",
    component: () => import("@/pages/404.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/board",
    name: "board",
    component: () => import("@/pages/BoardPage.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/check",
    name: "check",
    component: () => import("@/pages/CheckPage.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/chat",
    name: "chat",
    component: () => import("@/pages/ChatPage.vue"),
    meta: {
      keepAlive: false, //设置页面是否需要使用缓存
    },
  },
  {
    path: "/gacha",
    name: "gacha",
    component: () => import("@/pages/GachaPage.vue"),
    meta: {
      keepAlive: false, 
    },
  }
];
const router = createRouter({
  routes: routes,
  history: createWebHistory(),
});

export default router;
